import {RouteRecordRaw,createMemoryHistory,createRouter,createWebHistory} from 'vue-router'
//编写路由规则集合
//RouteRecordRaw是一个路由配置对象
const routes:Array<RouteRecordRaw>=[
    {
        path:'/hot',
        component:()=>import('@/views/HotNews.vue'),
        children:[
            {
               path:'',
               redirect:'/hot/local' 
            },
            {
                path:'domestic',
                component:()=>import('@/views/DomesticNews.vue')
            },
            {
                path:'international',
                component:()=>import('@/views/InternationalNews.vue')
            },
            {
                path:'local',
                component:()=>import('@/views/LocalNews.vue')
            },
            {
                path:'localdetail/:id',
                component:()=>import('@/views/LocalNewsDetail.vue')
            },
            {
                path:'domesticdetail',
                component:()=>import('@/views/DomesticNewsDetail.vue')
            }
        ]
    },
    {
        path:'/sport',
        component:()=>import('@/views/SportsNews.vue')
    },
    {
        path:'/financial',
        component:()=>import('@/views/FinancialNews.vue')
    }
]

/*
   通过createRouter函数完成router对象的创建，参数是一个配置对象
   history:路由模式
   routes:路由规则
*/
const router=createRouter({
    history:createMemoryHistory(),
    routes
})
export default router